package com.sf.dlb.utils;

import com.google.gson.Gson;

/**
 * Created by tanjing on 2018/12/12.
 */
public class GsonUtils {

    private static GsonUtils gsonUtils;

    private Gson gson;

    static {
        gsonUtils=new GsonUtils();
    }
    public GsonUtils(){
        gson=new Gson();
    }

    public static GsonUtils getInstance()
    {
        return gsonUtils;
    }

    public String toJson(Object object){
        return gson.toJson(object);
    }
    public Object fromJson(String json, Class classOfT){
        return gson.fromJson(json,classOfT);
    }


}
